Optimal. Leaf size=140 \[ \frac {b^4}{2 a^2 (a+b)^3 f \left (b+a \cos ^2(e+f x)\right )}+\frac {(a+2 b) \csc ^2(e+f x)}{(a+b)^3 f}-\frac {\csc ^4(e+f x)}{4 (a+b)^2 f}+\frac {b^3 (4 a+b) \log \left (b+a \cos ^2(e+f x)\right )}{2 a^2 (a+b)^4 f}+\frac {\left (a^2+4 a b+6 b^2\right ) \log (\sin (e+f x))}{(a+b)^4 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.14, antiderivative size = 140, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {4223, 457, 90}
\begin {gather*} \frac {b^4}{2 a^2 f (a+b)^3 \left (a \cos ^2(e+f x)+b\right )}+\frac {b^3 (4 a+b) \log \left (a \cos ^2(e+f x)+b\right )}{2 a^2 f (a+b)^4}+\frac {\left (a^2+4 a b+6 b^2\right ) \log (\sin (e+f x))}{f (a+b)^4}-\frac {\csc ^4(e+f x)}{4 f (a+b)^2}+\frac {(a+2 b) \csc ^2(e+f x)}{f (a+b)^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 90
Rule 457
Rule 4223
Rubi steps
\begin {align*} \int \frac {\cot ^5(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx &=-\frac {\text {Subst}\left (\int \frac {x^9}{\left (1-x^2\right )^3 \left (b+a x^2\right )^2} \, dx,x,\cos (e+f x)\right )}{f}\\ &=-\frac {\text {Subst}\left (\int \frac {x^4}{(1-x)^3 (b+a x)^2} \, dx,x,\cos ^2(e+f x)\right )}{2 f}\\ &=-\frac {\text {Subst}\left (\int \left (-\frac {1}{(a+b)^2 (-1+x)^3}-\frac {2 (a+2 b)}{(a+b)^3 (-1+x)^2}+\frac {-a^2-4 a b-6 b^2}{(a+b)^4 (-1+x)}+\frac {b^4}{a (a+b)^3 (b+a x)^2}-\frac {b^3 (4 a+b)}{a (a+b)^4 (b+a x)}\right ) \, dx,x,\cos ^2(e+f x)\right )}{2 f}\\ &=\frac {b^4}{2 a^2 (a+b)^3 f \left (b+a \cos ^2(e+f x)\right )}+\frac {(a+2 b) \csc ^2(e+f x)}{(a+b)^3 f}-\frac {\csc ^4(e+f x)}{4 (a+b)^2 f}+\frac {b^3 (4 a+b) \log \left (b+a \cos ^2(e+f x)\right )}{2 a^2 (a+b)^4 f}+\frac {\left (a^2+4 a b+6 b^2\right ) \log (\sin (e+f x))}{(a+b)^4 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.03, size = 162, normalized size = 1.16 \begin {gather*} \frac {(a+2 b+a \cos (2 (e+f x)))^2 \sec ^4(e+f x) \left (4 (a+b) (a+2 b) \csc ^2(e+f x)-(a+b)^2 \csc ^4(e+f x)+4 \left (a^2+4 a b+6 b^2\right ) \log (\sin (e+f x))+\frac {2 b^3 (4 a+b) \log \left (a+b-a \sin ^2(e+f x)\right )}{a^2}+\frac {2 b^4 (a+b)}{a^2 \left (a+b-a \sin ^2(e+f x)\right )}\right )}{16 (a+b)^4 f \left (a+b \sec ^2(e+f x)\right )^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.15, size = 201, normalized size = 1.44
method | result | size |
derivativedivides | \(\frac {\frac {b^{3} \left (\frac {\left (a +b \right ) b}{a^{2} \left (b +a \left (\cos ^{2}\left (f x +e \right )\right )\right )}+\frac {\left (4 a +b \right ) \ln \left (b +a \left (\cos ^{2}\left (f x +e \right )\right )\right )}{a^{2}}\right )}{2 \left (a +b \right )^{4}}-\frac {1}{16 \left (a +b \right )^{2} \left (\cos \left (f x +e \right )-1\right )^{2}}-\frac {7 a +15 b}{16 \left (a +b \right )^{3} \left (\cos \left (f x +e \right )-1\right )}+\frac {\left (a^{2}+4 a b +6 b^{2}\right ) \ln \left (\cos \left (f x +e \right )-1\right )}{2 \left (a +b \right )^{4}}-\frac {1}{16 \left (a +b \right )^{2} \left (1+\cos \left (f x +e \right )\right )^{2}}-\frac {-7 a -15 b}{16 \left (a +b \right )^{3} \left (1+\cos \left (f x +e \right )\right )}+\frac {\left (a^{2}+4 a b +6 b^{2}\right ) \ln \left (1+\cos \left (f x +e \right )\right )}{2 \left (a +b \right )^{4}}}{f}\) | \(201\) |
default | \(\frac {\frac {b^{3} \left (\frac {\left (a +b \right ) b}{a^{2} \left (b +a \left (\cos ^{2}\left (f x +e \right )\right )\right )}+\frac {\left (4 a +b \right ) \ln \left (b +a \left (\cos ^{2}\left (f x +e \right )\right )\right )}{a^{2}}\right )}{2 \left (a +b \right )^{4}}-\frac {1}{16 \left (a +b \right )^{2} \left (\cos \left (f x +e \right )-1\right )^{2}}-\frac {7 a +15 b}{16 \left (a +b \right )^{3} \left (\cos \left (f x +e \right )-1\right )}+\frac {\left (a^{2}+4 a b +6 b^{2}\right ) \ln \left (\cos \left (f x +e \right )-1\right )}{2 \left (a +b \right )^{4}}-\frac {1}{16 \left (a +b \right )^{2} \left (1+\cos \left (f x +e \right )\right )^{2}}-\frac {-7 a -15 b}{16 \left (a +b \right )^{3} \left (1+\cos \left (f x +e \right )\right )}+\frac {\left (a^{2}+4 a b +6 b^{2}\right ) \ln \left (1+\cos \left (f x +e \right )\right )}{2 \left (a +b \right )^{4}}}{f}\) | \(201\) |
risch | \(-\frac {12 i b^{2} x}{a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}}-\frac {8 i b^{3} x}{a \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {12 i b^{2} e}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {2 i b^{4} x}{a^{2} \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {8 i a b x}{a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}}-\frac {8 i b^{3} e}{a f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {8 i a b e}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {2 i a^{2} e}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {2 i b^{4} e}{a^{2} f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}-\frac {2 i a^{2} x}{a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}}+\frac {i x}{a^{2}}-\frac {2 \left (2 a^{4} {\mathrm e}^{10 i \left (f x +e \right )}+4 a^{3} b \,{\mathrm e}^{10 i \left (f x +e \right )}-b^{4} {\mathrm e}^{10 i \left (f x +e \right )}+2 a^{4} {\mathrm e}^{8 i \left (f x +e \right )}+10 a^{3} b \,{\mathrm e}^{8 i \left (f x +e \right )}+16 a^{2} b^{2} {\mathrm e}^{8 i \left (f x +e \right )}+4 b^{4} {\mathrm e}^{8 i \left (f x +e \right )}-12 a^{3} b \,{\mathrm e}^{6 i \left (f x +e \right )}-24 a^{2} b^{2} {\mathrm e}^{6 i \left (f x +e \right )}-6 b^{4} {\mathrm e}^{6 i \left (f x +e \right )}+2 a^{4} {\mathrm e}^{4 i \left (f x +e \right )}+10 a^{3} b \,{\mathrm e}^{4 i \left (f x +e \right )}+16 a^{2} b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+4 b^{4} {\mathrm e}^{4 i \left (f x +e \right )}+2 \,{\mathrm e}^{2 i \left (f x +e \right )} a^{4}+4 a^{3} b \,{\mathrm e}^{2 i \left (f x +e \right )}-b^{4} {\mathrm e}^{2 i \left (f x +e \right )}\right )}{f \left (a +b \right )^{3} \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{4} a^{2} \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) a^{2}}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}+\frac {4 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) a b}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}+\frac {6 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) b^{2}}{f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}+\frac {2 b^{3} \ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +2 b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a}+1\right )}{a f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}+\frac {b^{4} \ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +2 b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a}+1\right )}{2 a^{2} f \left (a^{4}+4 a^{3} b +6 a^{2} b^{2}+4 a \,b^{3}+b^{4}\right )}\) | \(999\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 285 vs.
\(2 (139) = 278\).
time = 0.27, size = 285, normalized size = 2.04 \begin {gather*} \frac {\frac {2 \, {\left (4 \, a b^{3} + b^{4}\right )} \log \left (a \sin \left (f x + e\right )^{2} - a - b\right )}{a^{6} + 4 \, a^{5} b + 6 \, a^{4} b^{2} + 4 \, a^{3} b^{3} + a^{2} b^{4}} + \frac {2 \, {\left (a^{2} + 4 \, a b + 6 \, b^{2}\right )} \log \left (\sin \left (f x + e\right )^{2}\right )}{a^{4} + 4 \, a^{3} b + 6 \, a^{2} b^{2} + 4 \, a b^{3} + b^{4}} + \frac {2 \, {\left (2 \, a^{4} + 4 \, a^{3} b - b^{4}\right )} \sin \left (f x + e\right )^{4} + a^{4} + 2 \, a^{3} b + a^{2} b^{2} - {\left (5 \, a^{4} + 13 \, a^{3} b + 8 \, a^{2} b^{2}\right )} \sin \left (f x + e\right )^{2}}{{\left (a^{6} + 3 \, a^{5} b + 3 \, a^{4} b^{2} + a^{3} b^{3}\right )} \sin \left (f x + e\right )^{6} - {\left (a^{6} + 4 \, a^{5} b + 6 \, a^{4} b^{2} + 4 \, a^{3} b^{3} + a^{2} b^{4}\right )} \sin \left (f x + e\right )^{4}}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 570 vs.
\(2 (139) = 278\).
time = 4.84, size = 570, normalized size = 4.07 \begin {gather*} \frac {3 \, a^{4} b + 10 \, a^{3} b^{2} + 7 \, a^{2} b^{3} + 2 \, a b^{4} + 2 \, b^{5} - 2 \, {\left (2 \, a^{5} + 6 \, a^{4} b + 4 \, a^{3} b^{2} - a b^{4} - b^{5}\right )} \cos \left (f x + e\right )^{4} + {\left (3 \, a^{5} + 6 \, a^{4} b - 5 \, a^{3} b^{2} - 8 \, a^{2} b^{3} - 4 \, a b^{4} - 4 \, b^{5}\right )} \cos \left (f x + e\right )^{2} + 2 \, {\left ({\left (4 \, a^{2} b^{3} + a b^{4}\right )} \cos \left (f x + e\right )^{6} + 4 \, a b^{4} + b^{5} - {\left (8 \, a^{2} b^{3} - 2 \, a b^{4} - b^{5}\right )} \cos \left (f x + e\right )^{4} + {\left (4 \, a^{2} b^{3} - 7 \, a b^{4} - 2 \, b^{5}\right )} \cos \left (f x + e\right )^{2}\right )} \log \left (a \cos \left (f x + e\right )^{2} + b\right ) + 4 \, {\left ({\left (a^{5} + 4 \, a^{4} b + 6 \, a^{3} b^{2}\right )} \cos \left (f x + e\right )^{6} + a^{4} b + 4 \, a^{3} b^{2} + 6 \, a^{2} b^{3} - {\left (2 \, a^{5} + 7 \, a^{4} b + 8 \, a^{3} b^{2} - 6 \, a^{2} b^{3}\right )} \cos \left (f x + e\right )^{4} + {\left (a^{5} + 2 \, a^{4} b - 2 \, a^{3} b^{2} - 12 \, a^{2} b^{3}\right )} \cos \left (f x + e\right )^{2}\right )} \log \left (\frac {1}{2} \, \sin \left (f x + e\right )\right )}{4 \, {\left ({\left (a^{7} + 4 \, a^{6} b + 6 \, a^{5} b^{2} + 4 \, a^{4} b^{3} + a^{3} b^{4}\right )} f \cos \left (f x + e\right )^{6} - {\left (2 \, a^{7} + 7 \, a^{6} b + 8 \, a^{5} b^{2} + 2 \, a^{4} b^{3} - 2 \, a^{3} b^{4} - a^{2} b^{5}\right )} f \cos \left (f x + e\right )^{4} + {\left (a^{7} + 2 \, a^{6} b - 2 \, a^{5} b^{2} - 8 \, a^{4} b^{3} - 7 \, a^{3} b^{4} - 2 \, a^{2} b^{5}\right )} f \cos \left (f x + e\right )^{2} + {\left (a^{6} b + 4 \, a^{5} b^{2} + 6 \, a^{4} b^{3} + 4 \, a^{3} b^{4} + a^{2} b^{5}\right )} f\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\cot ^{5}{\left (e + f x \right )}}{\left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 913 vs.
\(2 (134) = 268\).
time = 0.62, size = 913, normalized size = 6.52 \begin {gather*} \frac {\frac {32 \, {\left (4 \, a b^{3} + b^{4}\right )} \log \left (a + b + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {2 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}{a^{6} + 4 \, a^{5} b + 6 \, a^{4} b^{2} + 4 \, a^{3} b^{3} + a^{2} b^{4}} + \frac {32 \, {\left (a^{2} + 4 \, a b + 6 \, b^{2}\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right )}{a^{4} + 4 \, a^{3} b + 6 \, a^{2} b^{2} + 4 \, a b^{3} + b^{4}} - \frac {\frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {40 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {28 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {2 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}}{a^{4} + 4 \, a^{3} b + 6 \, a^{2} b^{2} + 4 \, a b^{3} + b^{4}} - \frac {{\left (a^{2} + 2 \, a b + b^{2} + \frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {40 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {28 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {48 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {192 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {288 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}^{2}}{{\left (a^{4} + 4 \, a^{3} b + 6 \, a^{2} b^{2} + 4 \, a b^{3} + b^{4}\right )} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}} - \frac {32 \, {\left (4 \, a^{2} b^{3} + 5 \, a b^{4} + b^{5} + \frac {8 \, a^{2} b^{3} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {2 \, a b^{4} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {2 \, b^{5} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {4 \, a^{2} b^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {5 \, a b^{4} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {b^{5} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (a^{6} + 4 \, a^{5} b + 6 \, a^{4} b^{2} + 4 \, a^{3} b^{3} + a^{2} b^{4}\right )} {\left (a + b + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {2 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}} - \frac {64 \, \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right )}{a^{2}}}{64 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.09, size = 206, normalized size = 1.47 \begin {gather*} \frac {\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (2\,a+5\,b\right )}{4\,{\left (a+b\right )}^2}-\frac {1}{4\,\left (a+b\right )}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (a^2\,b+3\,a\,b^2-b^3\right )}{2\,a\,{\left (a+b\right )}^3}}{f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^6+\left (a+b\right )\,{\mathrm {tan}\left (e+f\,x\right )}^4\right )}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,a^2\,f}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a^2+4\,a\,b+6\,b^2\right )}{f\,\left (a^4+4\,a^3\,b+6\,a^2\,b^2+4\,a\,b^3+b^4\right )}+\frac {b^3\,\ln \left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a+b\right )\,\left (4\,a+b\right )}{2\,a^2\,f\,{\left (a+b\right )}^4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________